Skip to content

compress_buf: fix musl segfaults#612

Open
aduskett wants to merge 1 commit intoopenSUSE:masterfrom
aduskett:fix-musl-segfault
Open

compress_buf: fix musl segfaults#612
aduskett wants to merge 1 commit intoopenSUSE:masterfrom
aduskett:fix-musl-segfault

Conversation

@aduskett
Copy link
Copy Markdown

By default, musl has a stack size of 128K, while the compress_buf method uses 256KB of stack space!

The easiest course of action is to add static thread_local to htab and hnext.

By default, musl has a stack size of 128K, while the compress_buf
method uses 256KB of stack space!

The easiest course of action is to add `static thread_local`
to htab and hnext.
@Conan-Kudo
Copy link
Copy Markdown
Member

Is it valid for musl's stack size to be so small?

@aduskett
Copy link
Copy Markdown
Author

Is it valid for musl's stack size to be so small?

yes

halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Mar 26, 2026
By default, musl has a stack size of 128K, while the compress_buf
method uses 256KB of stack space, causing a segfault when the
repopagestore_compress_page method is called.

Pull request: openSUSE/libsolv#612

Signed-off-by: Adam Duskett <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Mar 26, 2026
By default, musl has a stack size of 128K, while the compress_buf
method uses 256KB of stack space, causing a segfault when the
repopagestore_compress_page method is called.

Pull request: openSUSE/libsolv#612

Signed-off-by: Adam Duskett <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
@mlschroe
Copy link
Copy Markdown
Member

Can we put some #ifdef around that so that this is only done for musl? I don't think thread_local is available everywhere.

@aduskett
Copy link
Copy Markdown
Author

aduskett commented Mar 27, 2026

Can we put some #ifdef around that so that this is only done for musl? I don't think thread_local is available everywhere.

thread_local was introduced in C11 https://en.cppreference.com/w/c/thread/thread_local.html
and was removed from threads.h in C23 as thread_local is now a keyword as part of the language itself.

I added the threads.h include for backwards compatibility purposes for older compilers.

Can you point me to an instance where it isn't available?

@mlschroe
Copy link
Copy Markdown
Member

mlschroe commented Mar 27, 2026

I need to support older distributions as well. E.g. SUSE's SLE-12 distribution doesn't use C11 for compiling.
Maybe we should check __STDC_VERSION__

@Conan-Kudo
Copy link
Copy Markdown
Member

Conan-Kudo commented Mar 27, 2026

Current versions of libsolv are going into SLE 12? In that case, you could use one of the alternate compilers in SLE 12, couldn't you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants